#Dockerfile

# 构建阶段
FROM node:latest AS build

COPY package*.json ./

RUN npm config set registry=https://registry.npmmirror.com/

RUN npm install

COPY . .

RUN npm run build

# Nginx 阶段
FROM nginx:latest

# 从构建阶段中复制只需的文件
COPY --from=build dist/ /usr/share/nginx/html

# 替换默认的 Nginx 配置文件
COPY nginx.conf /etc/nginx/nginx.conf

# 暴露 Nginx 监听的端口
EXPOSE 80

# 启动 Nginx
CMD ["nginx", "-g", "daemon off;"]

